//var bb = page.evaluate(function () { 
//return document.getElementsByTagName('html')[0].getBoundingClientRect(); 
//});
//// 按照实际页面的高度，设定渲染的宽高
//page.clipRect = {
//top:    bb.top,
//left:   bb.left,
//width:  bb.width,
//height: bb.height
//};
//// 预留一定的渲染时间
//window.setTimeout(function () {
//page.render(file);
//page.close();
//console.log('render ok');
//}, 1000);
//改造后的代码如下：
 
var page = require('webpage').create(),
    system = require('system'),
    address, output, size;
 
//if () {
//  console.log('Usage: rasterize.js URL filename');
//  phantom.exit(1);
//} else {
//  address = system.args[1];
	address = 'https://detail.tmall.com/item.htm?id=545061345197&ali_trackid=17_dac701db6218e1377b2d09486ba66d62&spm=a21bo.50862.201862-3.1.47An6l'
//  output = system.args[2];
    page.viewportSize = { width: 1024, height: 600 };
    page.open(address, function (status) {
      // 通过在页面上执行脚本获取页面的渲染高度;
      var bb = page.evaluate(function () { 
        return document.getElementsByTagName('html')[0].getBoundingClientRect(); 
        
      });
      var content = page.evaluate(function() {
      	return document.body.innerHTML;
      })
      // 按照实际页面的高度，设定渲染的宽高
      page.clipRect = {
        top:    bb.top,
        left:   bb.left,
        width:  bb.width,
        height: bb.height
      };
      // 预留一定的渲染时间
      window.setTimeout(function () {
        page.render('newTaobao.png');
        console.log(content);
        page.close();
        console.log(bb.width);
        console.log(bb.height);
        console.log('render ok');
        phantom.exit();
      }, 60000);
    });
//} 